package com.wanfajie.smsdistribute.db.helper

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
import com.j256.ormlite.support.ConnectionSource
import com.j256.ormlite.table.TableUtils
import com.wanfajie.smsdistribute.config.SMS_DB_NAME
import com.wanfajie.smsdistribute.config.SMS_DB_VERSION
import com.wanfajie.smsdistribute.db.bean.sms.SmsBean
import com.wanfajie.smsdistribute.db.bean.sms.SmsPartBean

class SmsDatabaseHelper(ctx: Context): OrmLiteSqliteOpenHelper(
        ctx, SMS_DB_NAME, null, SMS_DB_VERSION
) {
    override fun onCreate(database: SQLiteDatabase?, connectionSource: ConnectionSource?) {
        TableUtils.createTableIfNotExists(connectionSource, SmsBean::class.java)
        TableUtils.createTableIfNotExists(connectionSource, SmsPartBean::class.java)
    }

    override fun onUpgrade(database: SQLiteDatabase?, connectionSource: ConnectionSource?, oldVersion: Int, newVersion: Int) {
    }
}
